template< typename T, unsigned int N >
Vector<T,N>& operator+=( Vector<T,N>& a, const Vector<T,N>& b ) {
  for( unsigned int i = 0; i < N; ++i ) {
    a[i] += b[i];
  }
  return a;
}

template< typename T, unsigned int N >
Vector<T,N> operator+( const Vector<T,N>& a, const Vector<T,N>& b ) {
  Vector<T,N> temp(a);
  temp += b;
  return temp;
}

template< typename T, unsigned int N >
Vector<T,N>& operator-=( Vector<T,N>& a, const Vector<T,N>& b ) {
  for( unsigned int i = 0; i < N; ++i ) {
    a[i] -= b[i];
  }
  return a;
}

template< typename T, unsigned int N >
Vector<T,N> operator-( const Vector<T,N>& a, const Vector<T,N>& b ) {
  Vector<T,N> temp(a);
  temp -= b;
  return temp;
}

template< typename T, unsigned int N >
T operator*( const Vector<T,N>& a, const Vector<T,N>& b ) {
  T val = 0;
  for( unsigned int i = 0; i < N; ++i ) {
    val += a[i]*b[i];
  }
  return val;
}

template< typename T >
Vector<T,3> operator^( Vector<T,3>& a, Vector<T,3>& b ) {
  T f[] = {a[1]*b[2] - a[2]*b[1],
           a[2]*b[0] - a[0]*b[2],
           a[0]*b[1] - a[1]*b[0]};
  Vector<T,3> temp( f );
  return temp;
}
